import request from "@/lib/utils/request";
import { PaginationType, Response, ResponseWithPagination } from "../common";
import type { Role } from "./role.d";

export const getRoleListApi = (
  params: PaginationType,
): ResponseWithPagination<Role> => {
  return request.get("/system/role/list", { params });
};

export const deleteRoleApi = (id: string): Response<null> => {
  return request.delete(`/system/role/${id}`);
};

export const getRoleApi = (id: string): Response<Role> => {
  return request.get(`/system/role/${id}`);
};

export const updateRoleApi = (data: Role): Response<null> => {
  return request.put("/system/role", data);
};

export const addRoleApi = (data: Role): Response<null> => {
  return request.post("/system/role", data);
};
